# models/base.py
from datetime import datetime
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column

class Base(DeclarativeBase):
    pass

class BaseModel(Base):
    __abstract__ = True  # 抽象类，不创建实际表

    id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
    create_time: Mapped[datetime] = mapped_column(default=datetime.utcnow)
    update_time: Mapped[datetime] = mapped_column(
        default=datetime.now(), onupdate=datetime.now()
    )
    is_deleted: Mapped[bool] = mapped_column(default=False)